<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        margin-left: 50px;
        margin-top: 50px;
      }
      li,
      p {
        width: 80px;
        height: 30px;
        line-height: 30px;
        text-align: center;
        list-style: none;
        border: 1px solid orange;
      }
      .box p {
        border: 0;
      }
      .box p:hover {
        background-color: #eee;
        color: orange;
      }
      .xiala {
        display: none;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <p>微博</p>
      <ul class="xiala">
        <li>私信</li>
        <li>评论</li>
        <li>@我</li>
      </ul>
    </div>
    <script>
      var weibo = document.querySelector("p");
      var xiala = document.querySelector(".xiala");
      weibo.onmouseover = function () {
        xiala.style.display = "block";
      };
      weibo.onmouseout = function () {
        xiala.style.display = "none";
      };
    </script>
  </body>
</html>
